import math
def nextGuess(lastGuess,n):
    return (lastGuess + ( n / lastGuess )) /2
def sqrt(n):
    last = 23423423
    next = nextGuess(last,n)
    while ( last - next ) > 0.00000001:
        last = next
        next = nextGuess(last,n)
    return next

print(math.sqrt(2))
print(sqrt(2))